package com.ruoyi.gigi.enums;

import java.util.stream.Stream;

/**
 * 签到方式枚举
 */
public enum SignInTypeEnum {
    PWD(0, "口令签到"),
    PHOTO(1, "拍照签到"),
    LOCATION(2, "位置签到"),
    BAR_CODE(3, "二维码签到")
    ;
    private Integer code;
    private String desc;

    SignInTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public static SignInTypeEnum getEnumByCode(final Integer code) {
        return Stream.of(SignInTypeEnum.values()).filter(item -> item.code.equals(code)).findFirst().orElse(null);
    }
}
